#ifndef _OBJECT_H_
#define _OBJECT_H_

#include "vec3f.h"
#include "color.h"

/** \brief Represents Objects that are in the World
 *
 * 	Everything which is in the World is represented as a subclass
 * 	of this Object class.
 */
class Object
{
	protected:
		Vec3f _pos; /**< Position of Object */
		Vec3f _rot; /**< Rotation of Object */
		Color _selectColor; /**< Color of Object in selection mode.
							Unique to each Object instance. */
		float _angle; /**< Rotation angle */

	public:
		/** \brief Draws the Object on the screen
		 *
		 * 	This function draws the Object on the screen; all drawing
		 * 	should be done relative to a local origin (0.0f, 0.0f, 0.0f).
		 */
		virtual void draw() = 0;

		/** \brief Allows the Object to perform actions
		 *
		 * 	For each Object in a World, the Object::act() method will be
		 * 	called after a fixed delay.
		 */
		virtual void act() = 0;

		/** \brief Sets the color to draw in selection mode
		 *
		 * 	\param c Selection mode color
		 */
		void setSelectColor(Color c) { _selectColor = c; }

		/** \brief Applies tranlation and rotation to current matrix stack
		 *
		 * 	Moves and rotates the matrix stack based on Object::_pos and
		 * 	Object::_rot. Applies to current matrix stack; push and pop
		 * 	matrix to avoid affecting current matrix stack.
		 */
		void moverot()
		{
			glTranslatef(_pos.x, _pos.y, _pos.z);
			glRotatef(_rot.x, 1.0f, 0.0f, 0.0f);
			glRotatef(_rot.y, 0.0f, 1.0f, 0.0f);
			glRotatef(_rot.z, 0.0f, 0.0f, 1.0f);
		}
};

#endif
